﻿using System.Text.RegularExpressions;
using System.Collections.Generic;

namespace WhySoSeries
{
    public class Series
    {
        public string Link { get; private set; }
        public string Name { get; set; }
        protected Dictionary<int, Season> seasons;

        public Series(string link)
        {
            Link = link;
            seasons = new Dictionary<int, Season>();
        }

        public void AddEpisode(Episode episode)
        {
            if (!seasons.ContainsKey(episode.Season.SeasonNumber))
                this.seasons.Add(episode.Season.SeasonNumber, new Season(this, episode.Season.SeasonNumber));
            this.seasons[episode.Season.SeasonNumber].AddEpisode(episode);
        }

        public IEnumerable<Season> GetSeasons()
        {
            return this.seasons.Values;
        }
    }
}
